package com.jprocms.module.cms.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 业务逻辑异常 Exception 为了返回模板view用
 */
@Data
@EqualsAndHashCode(callSuper = true)
public final class PortalServiceException extends RuntimeException {

    /**
     * 业务错误视图模板
     */
    private String tpl;
    /**
     * 错误提示
     */
    private String message;

    /**
     * 空构造方法，避免反序列化问题
     */
    public PortalServiceException() {
    }

    public PortalServiceException(String tpl, String message) {
        this.tpl = tpl;
        this.message = message;
    }

    public String getTpl() {
        return tpl;
    }

    public PortalServiceException setCode(String tpl) {
        this.tpl = tpl;
        return this;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public PortalServiceException setMessage(String message) {
        this.message = message;
        return this;
    }

}
